package com.flca.frw.events
{
	import com.adobe.cairngorm.control.CairngormEvent;
	import flash.events.Event;
	import mx.events.ItemClickEvent;
	import mx.controls.Menu;
	
	public class MenuClickEvent extends CairngormEvent
	{
		public static var EVENT_MENUCLICK : String = "menuClick";

		public var item : MenuItem;
		
		public function MenuClickEvent() {
			super( EVENT_MENUCLICK );
		}

     	public static function makeFromXML(aItem:XML) : MenuClickEvent 
     	{
			var result:MenuClickEvent = null;
			if (aItem != null) {
				result = new MenuClickEvent();
				result.item = MenuItem.makeFromXML(aItem);
			}
			return result;
     	}

     	public static function makeFromItemClickEvent(event:ItemClickEvent) : MenuClickEvent 
     	{
			var result:MenuClickEvent = null;
     		if (event.item != null) {
     			if (event.item.action != null) {
					result = new MenuClickEvent();
					result.item = MenuItem.makeFromObject(event.item);
     			}
     		} else {
     			return null;
     		}
			return result;
     	}
     	
		override public function clone() : Event {
			var result : MenuClickEvent = new MenuClickEvent();
			result.item = item;
			return result;
		}
		
	}
}